/**
 * @project_name extjs4
 * @package_name com.gxwz.extjs.action
 * @file_name UserManageAction.java
 */
package com.gxwz.extjs.action;

import java.util.HashSet;
import java.util.Set;

import com.gxwz.extjs.model.User;
import com.opensymphony.xwork2.ActionSupport;

/**
 * @author chendequan
 * @email: 1527254027@qq.com
 * @Time: 2013-9-3 上午10:06:30
 *
 */
@SuppressWarnings("serial")
public class UserManageAction extends ActionSupport {
	private static Set<User> users = new HashSet<User>();
	static {
		User u1 = new User("chendequan", 23, "chendequan@136.com");
		User u2 = new User("zhangsan", 12, "zhangsan@136.com");
		User u3 = new User("lisi", 55, "lisi@136.com");
		User u4 = new User("wangwu", 7, "wangwu@136.com");
		User u5 = new User("zhaoliu", 44, "chendequan@136.com");
		User u6 = new User("xiaoming", 87, "xiaoming@136.com");
		User u7 = new User("xiaohong", 52, "xiaohong@136.com");
		
		users.add(u1);
		users.add(u2);
		users.add(u3);
		users.add(u4);
		users.add(u5);
		users.add(u6);
		users.add(u7);
	}
	
	//private HttpServletResponse response = ServletActionContext.getResponse();
	
//	public void getUserList() throws IOException {
//		response.setCharacterEncoding("utf-8");
//		Writer writer = response.getWriter();
//		StringBuffer gridJson = 
//			new StringBuffer("{\"total\":\"" 
//					+ users.size() + "\", \"topics\": [{\"age:1, \"}]}\")"";
//			
//		for (User u : users) {
//			JsonConfig jcfg = FormatDate4Json.getCfgByYYYYMMDD();
//			JSONObject jsonObject = JSONObject.fromObject(users, jcfg);
//			//逗号分隔
//			gridJson.append(jsonObject).append(SymbolType.COMMA.showInfo);
//		}
//		if (0 != users.size()) {
//			gridJson.deleteCharAt(gridJson.length()-1);
//		}
//		gridJson.append("}}");
//		writer.write(gridJson.toString());
//		writer.close();
//	}
//	
//	public void deleteData() throws IOException {
//		System.out.println(getIds());
//	}
}
